// #[derive(Debug)]
struct User {
    is_admin: bool,
    user_name: String,
    pass_word: String,
    sign_in_count: u64,
}
impl User {
    fn set_is_admin(&mut self, is_admin: bool) {
        self.is_admin = is_admin;
    }
    fn set_user_name(&mut self, user_name: String) {
        self.user_name = user_name;
    }
    fn set_pass_word(&mut self, pass_word: String) {
        self.pass_word = pass_word;
    }
    fn set_sign_in_count(&mut self, sign_in_count: u64) {
        self.sign_in_count = sign_in_count;
    }

    fn dispay(&mut self) {
        println!(
            "is_admin: {}, user_name: {}, pass_word: {}, sign_in_count: {}",
            self.is_admin, self.user_name, self.pass_word, self.sign_in_count
        );
    }
}
impl User {
    fn new(is_admin: bool, user_name: String, pass_word: String, sign_in_count: u64) -> Self {
        Self {
            is_admin,
            user_name,
            pass_word,
            sign_in_count,
        }
    }
}
fn main() {
    let is_admin: bool = true;
    let user_name: String = String::from("陈威");
    let pass_word: String = String::from("Aa123456");
    let sign_in_count: u64 = 199;
    // let user_01 = create_new_user(is_admin, user_name, pass_word, sign_in_count);
    let mut _user01 = User::new(is_admin, user_name, pass_word, sign_in_count);

    _user01.dispay();

    _user01.set_is_admin(false);
    _user01.set_pass_word("Aa789456123".to_string());
    _user01.set_sign_in_count(200);
    _user01.set_user_name("李四".to_string());

    _user01.dispay();

    let mut user2 = User {
        user_name: String::from("another@example.com"),
        .._user01
    };

    user2.dispay();
}
